<%-- 
    Document   : view
    Created on : Mar 8, 2010, 10:49:03 AM
    Author     : Jagadeesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*" %>
<%@page import="model.Produk" %>
<%@page import="database.DBClass"%>
<%@page import="validation.ValidateForm"%>
<%@page import ="java.sql.*" %>
<%
    if (session.getAttribute("akun") == null) {
        response.sendRedirect(request.getContextPath() + "/admin/login.jsp");
    }

%>
<html>
    <head>
        <style type="text/css">
            body {
                background-color:black;
                background-image:url(images/4.jpg); 
            }
        </style>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="<%request.getContextPath();%>/E-Stonion/css/metro-bootstrap.css" rel="stylesheet"> 
        <link href="<%request.getContextPath();%>/E-Stonion/css/metro-bootstrap-responsive.css" rel="stylesheet">

        <script src="<%request.getContextPath();%>/E-Stonion/js/jquery/jquery.min.js"></script>
        <script src="<%request.getContextPath();%>/E-Stonion/js/jquery/jquery.widget.min.js"></script>

        <script src="<%request.getContextPath();%>/E-Stonion/js/metro/metro-*.js"></script>
        <title>View Produk Page</title>
    </head>
    <body class="metro">
    <nav class="navigation-bar">
        <nav class="navigation-bar-content">
            <a class="element" href="/E-Stonion/home.jsp">
                <span class="icon-grid-view"></span>
                E-Stonion </a>
            <span class="element-divider"></span>
            <a class="element" href="viewproduk">View Produk</a>
            <a class="element" href="insertproduk">Insert Produk</a>
            <a class="element" href="viewkoperasi">View Koperasi</a>
            <a class="element" href="insertkoperasi">Insert Koperasi</a>
            <span class="element-divider"></span>
            <a class="element place-right" href="LoginServlet?action=logout">Logout</a>
            <span class="element-divider place-right"></span>
        </nav>
    </nav> 
    <table width="100%"border="1" class="table table-striped">
        <tr>
            <th>ID Produk</th>
            <th>Nama Produk</th>
            <th>Harga Produk</th>
            <th>Jenis Produk</th>
            <th>Deskripsi Produk</th>         
            <th>ID Koperasi</th>
            <th>action</th>
        </tr>
        <%
            Produk bean = new Produk();
            DBClass dbobject = new DBClass();
            List list = dbobject.getAllproduk();
//                request.setAttribute("list", list);
//                List list2 = (List) request.getAttribute("list");
            if (list != null) {
                for (int i = 0; i < list.size(); i++) {
                    Produk ubean = (Produk) list.get(i);

        %>
        <tr>
            <td><%=ubean.getidproduk()%></td>
            <td><%=ubean.getnamaproduk()%></td>
            <td>Rp <%=ubean.gethargaproduk()%></td>
            <td><%=ubean.getjenisproduk()%></td>
            <td><%=ubean.getdeskripsiproduk()%></td>
            <td><%=ubean.getidkopf()%></td>
            <td><a href="ControllerServlet?action=editproduk&idproduk=<%=ubean.getidproduk()%>">update</a>
                |
                <a href="ControllerServlet?action=deleteproduk&idproduk=<%=ubean.getidproduk()%>">delete</a>
        </tr>
        <%
                }
            }
        %>
    </table>
</body>
</html>
